from utils.tools import get_snow_flake

from funboost import boost

import time
from funboost import boost, BrokerEnum

@boost(
    "test_insteda_thread_queue", broker_kind=BrokerEnum.MEMORY_QUEUE, concurrent_num=50
)
def gen_snowflage(x):
    snow_flake = get_snow_flake()
    with open("snowflake.txt", "a+") as f:
        f.write(str(snow_flake) + "\n")
    return snow_flake

if __name__ == "__main__":
    # for i in range(10000):
    #     gen_snowflage.push(i)
    # gen_snowflage.consume()
    with open("snowflake.txt", "r") as f:
        my_list = (f.read().split("\n"))

    from collections import Counter


    # 使用Counter计算每个元素的出现次数
    counter = Counter(my_list)

    # 打印出现次数大于1的元素
    for element, count in counter.items():
        if count > 1:
            print(f"{element}: {count} times")
